<?php
class models_hotro extends connect{
	
	function _listhotro()
	{
		$sql = 'SELECT MaHT,Nick,Ten,AnHien FROM hotro';
		$this-> query_db($sql);
		return $this->fetchAll();
	}
	function listhotro()
	{
		$sql = 'SELECT MaHT,Nick,Ten,AnHien FROM hotro
			WHERE AnHien=1';
		$this-> query_db($sql);
		return $this->fetchAll();
	}
	
	function _addhotro($Nick,$Ten,$AnHien)
	{
		$sql = "INSERT INTO hotro VALUES ('', '$Nick', '$Ten', '$AnHien')";
		$this->query_db($sql);
	}
	function _delhotro($id){
		$sql = "
				DELETE 
				FROM hotro
				WHERE MaHT = '$id'";
		$this->query_db($sql);
	}
	function _gethotro($id){
		$sql = "
				SELECT MaHT,Nick,Ten,AnHien
				FROM hotro
				WHERE MaHT = '$id'";
		$this->query_db($sql);
		return $this->fetchOne();
	}
	function _updatehotro($Nick,$Ten,$AnHien,$id){
		$sql = "UPDATE hotro
				SET 
				    Nick = '$Nick', 
					Ten = '$Ten',
					AnHien = '$AnHien'
					WHERE MaHT = '$id'";
		$this->query_db($sql);
	}
}
?>